package com.zhilianbao.leyaogo.http.api;

import android.content.Context;

import com.zhilianbao.leyaogo.constants.HttpConfig;
import com.zhilianbao.leyaogo.http.client.LeYaoGoClient;
import com.zhilianbao.leyaogo.utils.Utils;
import com.zhilianbao.okhttputils.callback.Callback;
import com.zhilianbao.okhttputils.model.JsonParams;

/**
 * ClassName: SupplierApi <br>
 * Description: 运营商相关API<br>
 * Author: Cyarie <br>
 * Created: 2016/11/17 18:24 <br>
 * Update Time：<br>
 * Update Description：<br>
 */
public class SupplierApi {

    /**
     * 获取城市运营商列表
     */
    public static final String METHOD_GET_SUPPLIER_LIST = "supplier/getSupplierList";

    /**
     * 获取运营商首页数据
     */
    public static final String METHOD_GET_SUPPLIER_HOME = "supplier/getHome";

    /**
     * 获取运营商城市列表
     */
    public static final String METHOD_GET_SUPPLIER_CITY_LIST = "supplier/getSupplierCityList";

    /**
     * 添加运营商用户信息
     */
    public static final String METHOD_ADD_SUPPLIER_USER = "supplier/addSupplierUser";

    /**
     * 获取城市运营商列表
     *
     * @param context
     * @param city     (string): 属于城市 来自数据字典AREA
     * @param callback
     */
    public static void getSupplierList(Context context, String city, long userId, Callback callback) {
        JsonParams jsonParams = new JsonParams();
        jsonParams.put("city", city);
        jsonParams.put("userId", userId);
        LeYaoGoClient.post(context, HttpConfig.BASE_URL + METHOD_GET_SUPPLIER_LIST, jsonParams, callback);

    }

    /**
     * 获取运营商首页数据
     *
     * @param context
     * @param supplierId 运营商ID
     * @param callback
     */
    public static void getSupplierHome(Context context, long supplierId, Callback callback) {
        JsonParams jsonParams = new JsonParams();
        jsonParams.put("supplierId", supplierId);
        LeYaoGoClient.post(context, HttpConfig.BASE_URL + METHOD_GET_SUPPLIER_HOME, jsonParams, callback);

    }

    /**
     * 获取运营商城市列表
     *
     * @param context
     * @param city
     * @param callback
     */
    public static void getSupplierCityList(Context context, String city, Callback callback) {
        JsonParams jsonParams = new JsonParams();
        jsonParams.put("city", city);
        LeYaoGoClient.post(context, HttpConfig.BASE_URL + METHOD_GET_SUPPLIER_CITY_LIST, jsonParams, callback);
    }

    /**
     * 添加运营商用户嘻嘻你
     *
     * @param context
     * @param callback
     */
    public static void addSupplierUser(Context context, Callback callback) {
        JsonParams jsonParams = new JsonParams();
        jsonParams.put("supplierId", Utils.getSupplierId());
        jsonParams.put("userId", Utils.getUserLoginInfo().getUserId());
        LeYaoGoClient.post(context, HttpConfig.BASE_URL + METHOD_ADD_SUPPLIER_USER, jsonParams, callback);
    }
}
